import request from '@/utils/request'

/**
 * 管理员查询信息列表组件配置内容
 * @returns {AxiosPromise}
 */
export function adminQueryTemplate(params) {
  return request({
    url: 'rest/api/template/news/admin/entity',
    method: 'get',
    params: params
  })
}

/**
 * 管理员保存信息列表配置项
 * @param object
 * @returns {AxiosPromise}
 */
export function adminSaveOrUpdate(object) {
  return request({
    url: 'rest/api/template/news/admin/entity',
    method: 'post',
    data: object
  })
}

/**
 * 用户保存自定义配置项
 * @param object
 * @returns {AxiosPromise}
 */
export function userSaveOrUpdate(object) {
  return request({
    url: 'rest/api/template/news/user/entity',
    method: 'post',
    data: object
  })
}

/**
 * 管理员删除配置项
 * @param params
 * @returns {AxiosPromise}
 */
export function adminDelete(params) {
  return request({
    url: 'rest/api/template/news/admin/entity',
    method: 'delete',
    params: params
  })
}

/**
 * 查询并解析信息列表组件
 * @param params
 * @returns {AxiosPromise}
 */
export function userAnalysisNews(params) {
  return request({
    url: 'rest/api/template/news/analysis/list',
    method: 'get',
    params: params
  })
}

/**
 * 查询并解析消息列表组件
 * 分页
 * @param params
 * @returns {AxiosPromise}
 */
export function userAnalysisNewsByPager(params) {
  return request({
    url: 'rest/api/template/news/analysis/list/page',
    method: 'get',
    params: params
  })
}

/**
 * 查询详情页
 * @param params
 * @returns {AxiosPromise}
 */
export function userAnalysisNewsByDetails(params) {
  return request({
    url: 'rest/api/template/news/analysis/entity/details',
    method: 'get',
    params: params
  })
}

/**
 * 查询附件下载
 * @param params
 * @returns {AxiosPromise}
 */
export function userAnalysisNewsByDownload(params) {
  return request({
    url: 'rest/api/template/news/analysis/entity/download',
    method: 'get',
    params: params
  })
}

/**
 * 附件在线预览
 * @param params
 * @returns {AxiosPromise}
 */
export function userAnalysisNewsByPDF(params) {
  return request({
    url: 'rest/api/template/news/analysis/entity/pdf',
    method: 'get',
    params: params
  })
}
